﻿using System.ComponentModel.DataAnnotations;
using DotNet.DataAnnotationsExtensions;
using DotNet.Entity;
using Newtonsoft.Json;

namespace XNWebModel
{
    /// <summary>
    /// 用户模型
    /// </summary>
    [Table(Name = "Users", Caption = "用户模型")]
    public class UserModel
    {
        /// <summary>
        /// 用户主键
        /// </summary>
        [PrimaryKey]
        public string Id { get; set; }

        /// <summary>
        /// 用户姓名
        /// </summary>
        [MaxLength(10, ErrorMessage = "用户姓名长度不能超过10个字符")]
        public string Name { get; set; }

        /// <summary>
        /// 用户账号
        /// </summary>
        [Required(ErrorMessage = "请输入手机号码")]
        [MaxLength(11, ErrorMessage = "手机号码长度不能超过11个字符")]
        [RegularExpression("^1[0-9]{10}$", ErrorMessage = "请输入正确的手机号码")]
        public string Account { get; set; }

        /// <summary>
        /// 用户密码
        /// </summary>
        [Required(ErrorMessage = "请输入用户密码")]
        [MaxLength(200, ErrorMessage = "用户账号密码不能超过200个字符")]
        [RegularExpression("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,21}$", ErrorMessage = "密码长度6-12位，必须包含字母和数字")]
        public string Password { get; set; }

        /// <summary>
        /// 出租密码
        /// </summary>
        [MaxLength(200, ErrorMessage = "用户账号密码不能超过200个字符")]
        public string TaxiPassword { get; set; }

        /// <summary>
        /// 停车密码
        /// </summary>
        [MaxLength(200, ErrorMessage = "用户账号密码不能超过200个字符")]
        public string ParkPassword { get; set; }

        /// <summary>
        /// 身份证号码
        /// </summary>
        [IdCard]
        public string IdentityNumber { get; set; }

        /// <summary>
        /// 微信OperId
        /// </summary>
        [MaxLength(50, ErrorMessage = "微信OperId不能超过50个字符")]
        public string WeiXinOperId { get; set; }

        /// <summary>
        /// 是否登录
        /// </summary>
        public bool IsLogin { get; set; }

    }
}